<?php
class WPaymentAdminParams extends UParamsWorklet
{	
	public function accessRules()
	{
		return array(
			array('allow', 'roles' => array('administrator')),
			array('deny', 'users'=>array('*'))
		);
	}
	
	public function properties()
	{
		return array(
			'elements' => array(
				'cSymbol' => array('type' => 'text', 'label' => $this->t('Currency Symbol')),
				'cCode' => array('type' => 'text', 'label' => $this->t('Currency Code'),
					'hint' => $this->t('3-character ISO-4217 code')),
			),
			'buttons' => array(
				'submit' => array('type' => 'submit', 'label' => $this->t('Save'))
			),
			'model' => $this->model
		);
	}
	
	public function taskRenderOutput()
	{
		parent::taskRenderOutput();
		
		$modules = $this->module->getModules();
		foreach($modules as $id=>$cfg)
		{
			$m = $this->module->getModule($id);
			if($m)
			{
				echo '<h4>'. ucfirst($m->getTitle()) .'</h4>';
				app()->controller->worklet('payment.' . $id . '.admin.params');
			}
		}
	}
}